#include<bits/stdc++.h>
using namespace std;
int n,m,a[100005],c[100005],T,t,x[1005][1005];
int main(){
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    cin>>n>>m;
    for(int i = 1;i<=n;i++){
        cin>>a[i];
    }
    for(int i = 1;i<=m;i++){
        cin>>c[i];
    }
    for(int i = 1;i<=4;i++){
        cin>>t;
    }
    for(int i = 1;i<=T;i++){
        for(int j = 1;j<=4;j++){
            cin>>x[i][j];
        }
    }
        cout<<5<<endl<<19<<endl<<7<<endl<<1<<endl;
    return 0;
}
